package kr.hkit.androidcomplete02.network;

import kr.hkit.androidcomplete02.R;
import android.app.Activity;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.widget.TextView;

public class ConMgr extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.conmgr);
		
		TextView result = (TextView) findViewById(R.id.resultcon);
		String sResult = "";
		ConnectivityManager mgr = 
				(ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
		
		NetworkInfo[] ani = mgr.getAllNetworkInfo();
		for(NetworkInfo n : ani){
			sResult += (n.toString() + "\n\n");
		}
		
		NetworkInfo ni = mgr.getActiveNetworkInfo();
		if(ni != null){
			sResult += ("Active : \n" + ni.toString() + "\n");
			result.setText(sResult);
		}
	}
}
